import Vue from 'vue';
import Router from 'vue-router';
import Main from '../components/Main';
import Second from "../components/Second";
import MyForm from "../views/MyForm";
import Login from "../views/Login";
import myInfo from "../views/myInfo";
//使用vue-router 安装路由
Vue.use(Router);
//创建路由实例
export default new Router({
  module: 'history',
  routes: [
    {
      name:'MainA',
      path:'/main/:userId',
      component: Main,
      pops: true
    },
    {
      path: '/second',
      component: Second
    },
    {
      path: '/myForm',
      component: MyForm
    },
    {
      path: '/login',
      component: Login
    },
    // { //无props方式传递参数
    //   path: '/myInfo/:userId',
    //   name: 'MyInfo',
    //   component: myInfo
    // },
    { //props 为true 方式传递参数  降低参数传递的耦合性
      path: '/myInfo/:userId',
      name: 'MyInfo',
      component: myInfo,
      props: true
    }
  ]
});
